package com.assistant.controller;

import com.assistant.pojo.GetPackage;
import com.assistant.service.GetPackageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/packageGetter")
public class GetPackageController {
    @Autowired
    private GetPackageService getPackageService;

    @PostMapping("/insert")
    public int insertGetPackage(@RequestBody GetPackage getPackage) {
        return getPackageService.insertGetPackage(getPackage);
    }

    @PutMapping("/update/{id}/{address_id}")
    public int updateAddressId(@PathVariable("id") Long id, @PathVariable("address_id") Integer address_id) {
        return getPackageService.updateGetPackage(id, address_id);
    }

    @PutMapping("/cancle/{id}")
    public int cancelGetPackageC(@PathVariable("id") Long id) {
        return getPackageService.cancelGetPackage(id);
    }

    @PutMapping("/finished/{id}")
    public int updateFinishedPackageC(@PathVariable("id") Long id) {
        return getPackageService.updateFinishedPackage(id);
    }
}
